package com.example.airoles.dto;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

public class ConversationSession {
    public String sessionId;
    public String userId;
    public String roleId;
    public String skill;
    public LocalDateTime createdAt;
    public LocalDateTime lastActiveAt;
    public List<ChatRequest.Message> messages;
    public ConversationContext context;
    
    public ConversationSession() {
        this.sessionId = UUID.randomUUID().toString();
        this.createdAt = LocalDateTime.now();
        this.lastActiveAt = LocalDateTime.now();
        this.messages = new ArrayList<>();
        this.context = new ConversationContext();
    }
    
    public ConversationSession(String userId, String roleId, String skill) {
        this();
        this.userId = userId;
        this.roleId = roleId;
        this.skill = skill;
    }
    
    public void addMessage(ChatRequest.Message message) {
        this.messages.add(message);
        this.lastActiveAt = LocalDateTime.now();
    }
    
    public void updateContext(String key, Object value) {
        this.context.data.put(key, value);
    }
    
    public static class ConversationContext {
        public java.util.Map<String, Object> data = new java.util.HashMap<>();
        public String emotionalState;
        public String currentTopic;
        public List<String> keyInsights = new ArrayList<>();
        public int messageCount = 0;
    }
}